/**
 * Created by PengWei on 2018/7/26.
 */
namespace game {
    import Sprite = egret.Sprite;
    import GComponent = fairygui.GComponent;
    import Stage = egret.Stage;
    import GRoot = fairygui.GRoot;

    /**
     * 层级
     */
    export class Layer {
        /** 最外层包裹容器 */
        private _rootContainer: Sprite;

        /** 场景容器 */
        private _sceneContainer: Sprite;

        /** UI容器 */
        private _uiContainer: GComponent;

        /** 弹出面板容器 */
        private _popUIContainer: GComponent;

        private _debugLayer:GComponent;

        public init(stage: Stage): void {
            this._rootContainer = new Sprite();

            this._sceneContainer = new Sprite();

            this._uiContainer = new GComponent();
            this._popUIContainer = new GComponent();
            this._debugLayer = new GComponent();;

            GRoot.inst.addChild(this._uiContainer);
            GRoot.inst.addChild(this._popUIContainer);
            GRoot.inst.addChild(this._debugLayer);

            this._rootContainer.addChild(this._sceneContainer);
            this._rootContainer.addChild(GRoot.inst.displayObject);

            stage.addChild(this._rootContainer);
        }

        public get sceneContainer(): Sprite {
            return this._sceneContainer;
        }

        public get uiContainer(): GComponent {
            return this._uiContainer;
        }

        public get popUIContainer(): GComponent {
            return this._popUIContainer;
        }

        public get debugLayer():GComponent{
            return this._debugLayer;
        }

    }
}